package com.xundao.yxt;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * App
 * @author ming
 */
@Slf4j
@SpringBootApplication(scanBasePackages = {"com.xundao.yxt"})
public class App {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(App.class, args);
        Environment env = applicationContext.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        String contextPath = env.getProperty("server.servlet.context-path","");
        log.info("\n" +
                "----------------------------------------------------------\n\t" +
                "Application is running! Access URLs:\n\t" +
                "Local: \thttp://localhost:{}{}\n\t" +
                "External: \thttp://{}:{}{}\n" +
                "----------------------------------------------------------",
                port, contextPath,
                ip, port, contextPath);
    }
}
